#ifndef MAININTERFACE_H
#define MAININTERFACE_H

#include <QMainWindow>
#include <QWidget>
#include <QTimer>
#include <QLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QListWidget>
#include <QMenu>
#include <QMenuBar>
#include <QTextEdit>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QDebug>
#include <QCursor>
#include <QPushButton>
#include <QLabel>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QUrl>
#include <QMimeData>
#include <QByteArray>
#include <QHttpMultiPart>
#include <QHttpPart>
#include <QElapsedTimer>
#include <QThread>
#include <QTime>
#include <list>
#include <mutex>
#include <string>
#include <Windows.h>
#include <iostream>
#include <thread>
using std::list;
using std::mutex;
using std::string;

#include "../Shadewidget/shadewidget.h"

class Maininterface : public QMainWindow
{

public:
    void Init();
    Maininterface(QWidget* parent = nullptr);

    void Httprequest(QString text);

    void Httprecv(QString text);

    QWidget* parent;

    Shadewidget* shadewidget = nullptr;

//    void ThreadRecv();

    bool RecvMessage = false;


    QTimer* timer;


private slots:
    void onPersonMenuTriggered();
    void onFileMenuTriggered();
    void onListItemClicked(QListWidgetItem *item);
    void handleRequestNetworkData();
    void handleRecvNetworkData();
    void onButton1Clicked();
    void onButton2Clicked();
    void onButton3Clicked();
    void onButton4Clicked();
    void sendButtonClicked();
    void HttpPost();
public:
    // 创建中心部件和水平布局
    QWidget *centralWidget;
    QHBoxLayout *layout;

    // 创建并添加菜单栏
    QMenuBar *menuBar;
    QAction *fileAction;

    QAction *personAction;
    // 创建消息列表
    QListWidget *messageList;

    // 创建文本编辑框
    QTextEdit *textEdit;

    QVBoxLayout *layout1;

    QListWidget *listWidget;

    QHBoxLayout *buttonLayout;
    QList<QPushButton* >* buttonList;

    QTextEdit *textEditl;
    QPushButton *sendButton;
    QHBoxLayout *layout2;
    QSpacerItem *spacer;
};

#endif // MAININTERFACE_H
